package com.yzy.fly.service.util;

import com.google.common.collect.Lists;
import com.yzy.fly.entity.core.*;
import com.yzy.fly.entity.role.FlyAttribute;
import com.yzy.fly.entity.role.FlyModel;
import com.yzy.fly.type.JDKVersionType;
import com.yzy.fly.util.ListUtil;

import java.util.List;

public class FlyMethodConfigUtil {

    public static class ConfigConvert{
        public static List<FlyMethod> sqlToMethodes(FlyClass flyClass) {
            List<FlyMethod> methods = Lists.newArrayList();
//            List<FlySql> sqlList = flyClass.getSqlList();
//            for (int i = 0; i < sqlList.size(); i++) {
//                FlySql flySql =  sqlList.get(i);
//                methods.add(sqlToMethod(flySql));
//            }
            return methods;
        }

        public static FlyMethod sqlToMethod(FlySql flySql) {
            FlyMethod flyMethod = new FlyMethod();
            flyMethod.setSeq(flySql.getSeq());
            flyMethod.setPackageName(flySql.getPackageName());
            flyMethod.setClassName(flySql.getClassName());
            flyMethod.setLabel(flySql.getLabel());
            flyMethod.setName(flySql.getName());
            flyMethod.setMethodName(flySql.getSqlId());
            flyMethod.setType(flySql.getType());
            flyMethod.setDataSource(flySql.getDataSource());
            flyMethod.setDatabaseType(flySql.getDatabaseType());
            flyMethod.setSqlContent(flySql.getSqlContent());
            flyMethod.setParams(flySql.getParams());
            flyMethod.setReturnClass(flySql.getReturnClass());
            flyMethod.setSqlId(flySql.getId());
//            flyMethod.setClassId(flySql.getClassId());
            flyMethod.setSystemId(flySql.getSystemId());
            flyMethod.setSqlDesc(flySql.getSqlDesc());
            flyMethod.setDescr(flySql.getDescr());
            flyMethod.setCreateTime(flySql.getCreateTime());
            flyMethod.setUpdateTime(flySql.getUpdateTime());
            return flyMethod;
        }

    }

}